package Server;
import java.util.ArrayList;
import java.util.List;

import newEventMonitor.pojo.FPEvent;
import newEventMonitor.pojo.FPTexts;
import newEventMonitor.pojo.FpRule;
import newEventMonitor.service.NewEventService;
import newEventMonitor.service.TextServer;

public class FIHC {
	public List<String> fichClustering(){
		new TextServer();
		new NewEventService();
		FpRule fpRule = new FpRule();
		List<FPTexts> fpData = TextServer.TextsMaker("D:/workspace/HotEventMonitoring/2017年1月-2017年12月嘉兴的单子信息/fihcsave.txt");
		List<FPEvent> resultTop5 = null;
		try {
			resultTop5 = NewEventService.findFP(fpData, fpRule);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		List<String> resultlist = new ArrayList<>();
		for(FPEvent fpEvent:resultTop5){
			String s = "";
			s+=(fpEvent.getFpitems()+"|匹配工单|");
			for(FPTexts fTexts:fpEvent.getAllFPTexts()){
				s+=(fTexts.getTextid()+"|");
			}
			resultlist.add(s);
		}
		return resultlist;
	}
	public static void main(String[] args) throws Exception {
		new TextServer();
		new NewEventService();
		FpRule fpRule = new FpRule();
		List<FPTexts> fpData = TextServer.TextsMaker("D:/workspace/HotEventMonitoring/2017年1月-2017年12月嘉兴的单子信息/fihcsave.txt");
		List<FPEvent> resultTop5 = NewEventService.findFP(fpData, fpRule);
		System.out.println(resultTop5.size());
		for(FPEvent fpEvent:resultTop5){
			System.out.print(fpEvent.getFpitems()+"|匹配工单|");
			for(FPTexts fTexts:fpEvent.getAllFPTexts()){
				System.out.print(fTexts.getTextid()+"|");
			}
			System.out.println();
		}
	}
}
